#include "Tree.h"
#include "ResourceManager.h"
#include <d3dx9.h>

Tree::Tree(int id,float x, float y, int type)
{
	if(type == 24)
	{
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Tree_Bottom),0, 0);
		_id = id;
		_x = x;
		_y = y;
	}
	if(type == 25)
	{
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Tree_Middle),0, 0);
		_id = id;
		_x = x;
		_y = y;
	}
	if(type == 26)
	{
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Tree_Top),0, 0);
		_id = id;
		_x = x;
		_y = y;
	}
	if(type == 27)
	{
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Tree_Small),0, 0);
		_id = id;
		_x = x;
		_y = y;
	}
	if(type == 28)
	{
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Trunk),0, 0);
		_id = id;
		_x = x;
		_y = y;
	}
	_width = _sprite->getTexture()->getWidth();
	_height = _sprite->getTexture()->getHeight();
}

Tree::~Tree(void)
{
	if (_sprite)
	{
		delete _sprite;
	}
	
}

void Tree::Update(list<Object *> *_list, float time)
{
}


void Tree:: Render(int vpX, int vpY)
{
	_sprite->Render(_x, _y, vpX, vpY);
}

OBJECT_TYPE Tree::getObjectType()
{
	return OBJECT_STATIC;
}